<!DOCTYPE html>
<html lang="en">
	<head>
	<meta charset="utf-8" />
	<title>鼠标容器</title>
	<script type="text/javascript" src="../../lufylegend-1.8.12.min.js"></script>
	<script type="text/javascript" src="../../lib/lufylegend.ui-0.8.0.min.js"></script>
	</head>
	<body>
			<div id="legend"></div>
<script>
init(50,"legend",800,450,main);
var layer,label,button01,button02;
function main(){
	LGlobal.setDebug(true);
	LMouseEventContainer.set(LMouseEvent.MOUSE_DOWN,true);
	LMouseEventContainer.set(LMouseEvent.MOUSE_UP,true);
	LMouseEventContainer.set(LMouseEvent.MOUSE_MOVE,true);
	//设定鼠标事件为触发所有事件
	LMouseEventContainer.dispatchAllEvent = true;
	
	var backLayer = new LSprite();
	backLayer.graphics.drawRect(1,"#000000",[0,0,LGlobal.width,LGlobal.height],true,"#cccccc");
	addChild(backLayer);
	
	var w = 0;
	label = new LTextField();
	label.text = "使用鼠标容器后，设定鼠标事件为触发";
	label.size = 18;
	label.x = 10;
	label.y = 10;
	backLayer.addChild(label);
	w = label.getWidth();
	label = new LTextField();
	label.text = "所有事件";
	label.color = "#FF0000";
	label.size = 18;
	label.x = 10 + w;
	label.y = 10;
	backLayer.addChild(label);
	
	layer = new LSprite();
	layer.y = 100;
	layer.graphics.drawRect(2,"#ff0000",[0,0,500,300],true,"#880088");
	backLayer.addChild(layer);
	
	button01 = new LButtonSample1("测试按钮1",50);
	button01.x = 10;
	button01.y = 10;
	layer.addChild(button01);
	
	button02 = new LButtonSample1("测试按钮2");
	button02.x = 15;
	button02.y = 15;
	layer.addChild(button02);
	
	label = new LTextField();
	label.text = "layer01";
	label.size = 20;
	label.x = 400;
	label.y = 10;
	layer.addChild(label);
	
	mouseevent();
}
function mouseevent(){
	layer.addEventListener(LMouseEvent.MOUSE_DOWN,mousedownlayer);
	layer.addEventListener(LMouseEvent.MOUSE_UP,mouseuplayer);
	
	button01.addEventListener(LMouseEvent.MOUSE_DOWN,mousedownbutton01);
	button01.addEventListener(LMouseEvent.MOUSE_UP,mouseupbutton01);
	
	button02.addEventListener(LMouseEvent.MOUSE_DOWN,mousedownbutton02);
	button02.addEventListener(LMouseEvent.MOUSE_UP,mouseupbutton02);
}
function mousedownlayer(e){
	trace("layer01 is mousedown");
}
function mouseuplayer(e){
	trace("layer01 is mouseup");
}
function mousedownbutton01(e){
	trace("button01 is mousedown");
}
function mouseupbutton01(e){
	trace("button01 is mouseup");
}
function mousedownbutton02(e){
	trace("button02 is mousedown");
}
function mouseupbutton02(e){
	trace("button02 is mouseup");
}
</script>
	</body>
</html>
